%% clear clc
clear;clc

%% define variable
syms Ts fc depth slope
syms s
syms w0_N eta_N w0_D eta_D
syms f0_N f0_D

assume([Ts fc depth slope], 'positive')
assume([w0_N eta_N w0_D eta_D], 'positive')
assume([f0_N f0_D], 'positive')

%% init param
Ts = 1e-4
fc = 50
depth = 1/3
eta_N = 0.2
eta_D = 0.5
%% param settings
equ = [depth==(f0_D/f0_N)^2, ...
       f0_D == fc, ...
       w0_N == 2*pi*f0_N, ...
       w0_D == 2*pi*f0_D]

sol = solve(equ, [w0_N, w0_D, f0_N, f0_D])
w0_N = single(sol.w0_N)
w0_D = single(sol.w0_D)

%% bode plot
% sys = depth*tf([1 2*eta_N*w0_N w0_N^2], [1 2*eta_D*w0_D w0_D^2])
% bode(sys)
[num,den]=c2dm(depth*[1 2*eta_N*w0_N w0_N^2], [1 2*eta_D*w0_D w0_D^2],Ts,'tustin')
dbode(num,den,Ts);